<template>
  <div class="carrier-wrap">
    <nr-select v-model="carrierId"
               :options="customerSelect"
               :props="{ label: 'name', value: 'carrierId' }"
               placeholder="请选择承运方"
               @change="input" />
  </div>
</template>

<script>
import nrSelect from "@/components/nr/select/Index";
import carrier from "@/api/modules/carrier";

export default {
  name: "Carrier",
  components: { nrSelect },
  props: {
    value: {
      type: [String, Number],
      default: null
    }
  },
  data () {
    return {
      customerSelect: [],
      carrierId: this.value
    };
  },
  created () {
    this.customerInit();
  },
  methods: {
    async customerInit () {
      let params = { page: 1, size: 10000 };
      let response = await carrier.search(params);
      let { records } = response.data;
      this.customerSelect = records;
    },
    input (value) {
      this.$emit("handleInput", value);
    }
  }
};
</script>

<style></style>
